import 'package:flutter/material.dart';
import 'package:pass_log/app/core/utils/adapt.dart';
import 'package:pass_log/app/data/services/theme_service.dart';
import 'package:pass_log/app/modules/home/widgets/home_pass_list.dart';

typedef ObjItem = Map<String, dynamic>;

class HomeSearchList extends StatelessWidget {
  final List<ObjItem?> searchList;
  const HomeSearchList({super.key, required this.searchList});

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      width: Adapt.pt(375),
      child: ExpansionPanelList(
        animationDuration: const Duration(milliseconds: 200),
        children: [
          ExpansionPanel(
            isExpanded: true,
            // 外层密码分类
            headerBuilder: (context, index) => Flex(
              direction: Axis.horizontal,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                SizedBox(width: Adapt.pt(20)),
                Container(
                  height: Adapt.pt(36),
                  width: Adapt.pt(36),
                  decoration: BoxDecoration(
                    color: ThemeService.to.curColorScheme.primaryContainer,
                    shape: BoxShape.circle,
                  ),
                  child: const Icon(Icons.content_paste_search_rounded),
                ),
                SizedBox(width: Adapt.pt(20)),
                Container(
                  alignment: Alignment.center,
                  height: Adapt.pt(50),
                  child: Text(
                    "搜索结果",
                    style: TextStyle(
                      color: ThemeService.to.curColorScheme.onPrimaryContainer,
                      fontSize: Adapt.pt(18),
                    ),
                  ),
                ),
              ],
            ),
            // 内层密码列表
            body: Container(
              decoration: BoxDecoration(color: ThemeService.to.curColorScheme.secondaryContainer),
              child: HomePassList(passList: searchList),
            ),
          ),
        ],
      ),
    );
  }
}
